﻿namespace minioClient.ExUtil
{
    /// <summary>ContentType枚举帮助类
    /// ContentType枚举帮助类
    /// </summary>
    public static class Helper
    {
        /// <summary>
        /// 根据枚举返回ContentType
        /// </summary>
        /// <param name="type">枚举类型</param>
        /// <returns></returns>
        public static string DoContentType(Content_Type type)
        {
            string Result = "application/octet-stream";
            switch (type)
            {
                case Content_Type.bmp:
                    Result = "application/x-bmp";
                    break;
                case Content_Type.biz:
                    Result = "text/xml";
                    break;
                case Content_Type.exe:
                    Result = "application/x-msdownload";
                    break;
                case Content_Type.gif:
                    Result = "image/gif";
                    break;
                case Content_Type.html:
                    Result = "text/html";
                    break;
                case Content_Type.ico:
                    Result = "image/x-icon";
                    break;
                case Content_Type.img:
                    Result = "application/x-img";
                    break;
                case Content_Type.jpe:
                    Result = "image/jpeg";
                    break;
                case Content_Type.jpeg:
                    Result = "image/jpeg";
                    break;
                case Content_Type.jpg:
                    Result = "image/jpeg";
                    break;
                case Content_Type.movie:
                    Result = "video/x-sgi-movie";
                    break;
                case Content_Type.mp3:
                    Result = "audio/mp3";
                    break;
                case Content_Type.mp4:
                    Result = "video/mpeg4";
                    break;
                case Content_Type.pdf:
                    Result = "application/pdf";
                    break;
                case Content_Type.png:
                    Result = "image/png";
                    break;
                case Content_Type.ppt:
                    Result = "application/x-ppt";
                    break;
                case Content_Type.txt:
                    Result = "text/plain";
                    break;
                case Content_Type.xls:
                    Result = "application/x-xls";
                    break;
                case Content_Type.xsl:
                    Result = "text/xml";
                    break;
                case Content_Type.apk:
                    Result = "application/vnd.android.package-archive";
                    break;
            }
            return Result;
        }
    }
}
